package com.rpj.stauy.controller;

import com.rpj.stauy.service.StreamChatAssistant;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import reactor.core.publisher.Flux;

@RestController
@Slf4j
public class StreamController {

    @Resource(name = "chatstream")
    private StreamChatAssistant streamChatAssistant;


    // http://localhost:9095/stream/chat
    @GetMapping("stream/chat")
    public Flux<String> streamChat(@RequestParam(value = "prompt",defaultValue = "你是谁") String prompt){
        return streamChatAssistant.chatFlux(prompt);
    }
}
